package cn.itsource.basic.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/*
SpringMVC的配置类
* */



@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {

    @Autowired
    LoginInterceptor loginInterceptor;

    /*
    为SpringMVC添加拦截器
    */

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/user/register/phone")
                .excludePathPatterns("/shop/settlement")
                .excludePathPatterns("fastDfs/**")
                .excludePathPatterns("/verifyCode/**");

    }
}
